LogFile=/tmp/ping.log
mdate=`date +%Y-%m-%d-%R`

if [ -e /var/run/udhcpc-wwan0.pid ]; then
    echo 4G pid is ok!
    #echo $mdate 4G pid is ok! >> $LogFile
    #exit 0
else
    echo 4G pid is failed!
    echo $mdate 4G pid is failed! >> $LogFile
    #/etc/myLte/dial4g
    #reboot
    #exit 0
fi

if ping -c3 www.baidu.com > /dev/null 2>&1
then
    echo ping baidu is ok!
    #echo $mdat ping baidu is ok! >> $LogFile
    exit 0
else
    echo ping baidu is failed!
    echo $mdate ping baidu is failed! network restart  >> $LogFile
    /etc/init.d/network restart
fi
exit 0
